package day25;

import java.util.LinkedList;
import java.util.List;

/**
 * @ClassName Soluton
 * @Description TODO
 * @Author clockTown
 * @Date 2021/6/3 19:17
 * @Version 1.0
 */
public class Solution1 {
    public ListNode middleNode(ListNode head) {


        ListNode fast = head, slow = head;

        while (fast.next != null && fast.next.next != null){
            fast = fast.next.next;
            slow = slow.next;
        }

        if (fast.next != null){
            slow = slow.next;
        }

        return slow;
    }
}
